CC = gcc
CFLAGS = -g -Wall -D_FILE_OFFSET_BITS=64 -Iinclude

SRC = xbicommon.c xbiimage.c xbiss.c xbipfi.c xbidmi.c xbiccrt.c xbixfselement.c xbixex.c xbiivh.c

OBJ = $(SRC:.c=.o)

all: libxbi test

libxbi: $(SRC)
	ar rcs libxbi.a $(?:.c=.o)
	ranlib libxbi.a

$(SRC):
	$(CC) -c $(CFLAGS) sources/$@ -o $(@:.c=.o)

test: libxbi
	$(CC) $(CFLAGS) xbi.c -lxbi -L. -o xbi

clean:
	rm -rf $(OBJ) *~ xbi \#* libxbi.a build/ *.dSYM